<extend name="Public/base"/>
<block name="body">
    <!-- 标题栏 -->
    <div class="main-title">
        <h2>用户列表</h2>
    </div>
    <div class="data-table table-striped">
    <table class="">
    <thead>
        <tr>
         
        <th class="">序号</th>
        <th class="">学生姓名</th>
        <th class="">预约时间</th>
        <th class="">回访内容</th>
        <th class="">回访时间</th>
        <th class="">预约下次回访时间</th>
        <th class="">备注</th>
        <th class="">管理员</th>
     
        </tr>
    </thead>
    <tbody>
        <volist name="_datalist" id="vo">
        <tr>
            <td>{$i}</td>
            <td>{$vo.fullname}</td>
            <td>{$vo.trial_time}</td>
            <td><textarea>{$vo.visit_conter}</textarea></td>
            <td>{$vo.visit_updatetime|date="Y-m-d",###}</td>
            <td>{$vo.visit_next_time|date="Y-m-d",###}</td>
            <td><textarea>{$vo.visit_remark}</textarea></td>
            <td>{$vo.admin_name}</td> 
        </tr> 
        </volist>
        </tbody>
    </table> 
    </div>
    <!-- 数据列表 -->
    <if condition="$_datalist eq false" >
    <div style="padding: 20px;text-align: center;border: 1px solid #ccc; border-radius: 8px;">
        暂无数据
    </div>
    </if>
    <div class="main-title" style="background-color: #E8E8E8;padding: 10px;margin-top: 10px;">
        <h2>新增回访</h2>
    </div>
    <form action="{:U('admin/studen/access_save')}" method="post" id="accessFrm" class="form-horizontal">
        <div class="form-item">
            <label class="item-label">用户姓名<span class="check-tips">*</span></label>
            <div class="controls">
                {$row.fullname}
            </div>
        </div>
        
        <div class="form-item">
            <label class="item-label">回访内容</label>
            <div class="controls">
                <textarea name="visit_conter" id="visit_conter"></textarea>
            </div>
        </div>
        
        <div class="form-item">
            <label class="item-label">是否试听</label>
            <div class="controls">
                <input name="is_trial" id="is_trial" type="checkbox" /> 是 
            </div> 
        </div> 

        <div class="form-item trial-time-wrap" style="display:none">
            <label class="item-label">试听时间</label>
            <div class="controls trial_time">
                <input name="trial_time" id="trial_time" />
            </div> 
        </div>

        <div class="form-item">
            <label class="item-label">下次回访时间</label>
            <div class="controls">
                <input name="visit_next_time" id="visit_next_time" />
            </div> 
        </div>

        <div class="form-item">
            <label class="item-label">备注</label>
            <div class="controls">
                <textarea name="visit_remark" id="visit_remark"></textarea>
            </div>
        </div>

        <div class="form-item">
             
            <button class="btn submit-btn ajax-post"   onclick="jAccessSave();" >确 定</button>
            <a class="btn btn-return" href="{:session('lastUrl')}" >返 回</a>
        </div>
        <input type="hidden" name="sid" value="{$row.sid}" />
    </form>
</block>

<block name="script">
    <script src="__STATIC__/thinkbox/jquery.thinkbox.js"></script>
<link href="/Public/static/datetimepicker/css/datetimepicker.css" rel="stylesheet" type="text/css">
<link href="/Public/static/datetimepicker/css/datetimepicker_blue.css" rel="stylesheet" type="text/css"><link href="/Public/static/datetimepicker/css/dropdown.css" rel="stylesheet" type="text/css">
<script type="text/javascript" src="/Public/static/datetimepicker/js/bootstrap-datetimepicker.min.js"></script>
<script type="text/javascript" src="/Public/static/datetimepicker/js/locales/bootstrap-datetimepicker.zh-CN.js" charset="UTF-8"></script>

<script type="text/javascript" src="/Public/static/ajaxfileupload.js" charset="UTF-8"></script>

    <script type="text/javascript">
        // Think.setValue("type", {$info.type|default=0});
        // Think.setValue("group", {$info.group|default=0});
        //导航高亮
        $('.side-sub-menu').find('a[href="{:U('User/index')}"]').closest('li').addClass('current');

        $(document).on("change",".is_effective",function(){
                _self = this;
                if (_self.value==0) {
                    $(".invalid_memo").show();
                } else {
                    $(".invalid_memo").hide();
                }
            })

        function jAccessSave() {
            _visit_conter = $("#visit_conter").val();
            if (_visit_conter=='') {
                alert("回访内容不能为空");
                return false;
            }
          
            if ($("#is_trial").prop('checked') && $("#visit_next_time").val()=='' ) {
                alert("试听时间不能为空");
                return false;
            }
            _frm = $("#accessFrm");
 
            $.post(_frm.attr("action"),_frm.serialize(),function(res){
 
                _obj = eval("("+res+")");
                if (_obj.status=='success') {
                    alert("提交成功");
                 
                    
                        setTimeout(function(){
                           location=location ;
                        },500);

                    
                }
            })
            return false;
        } 

        $('#visit_next_time').datetimepicker({
            format: 'yyyy-mm-dd',
            language:"zh-CN",
            minView:2,
            autoclose:true
        });

        $('#trial_time').datetimepicker({
            format: 'yyyy-mm-dd',
            language:"zh-CN",
            minView:2,
            autoclose:true
        });

        $(document).on("click","#is_trial",function() {
 
            if ($(this).prop('checked')) {
                $(".trial-time-wrap").show();
            } else {
                $(".trial-time-wrap").hide();
            }
        })
    </script>
</block>

 